package com.study.d6_io_buffer;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.Writer;

public class CharDemo2 {
    public static void main(String[] args) {
        //目标：掌握缓存字符输出流使用  并且新增了newline功能
        try (
                Writer wr = new FileWriter("day10/src/dlei5.txt", true);
                BufferedWriter bw = new BufferedWriter(wr);
        ) {
            //bufferwrite类新增了newline功能
            bw.write(65);
            bw.write('磊');
            bw.newLine();
            bw.write("我爱china");
            bw.newLine();
            bw.write("safa我爱你中国铯8暗示5sa", 4, 5);
            bw.newLine();
            char[] charArray = "我爱中国".toCharArray();
            bw.write(charArray);
            bw.newLine();
            bw.write(charArray, 2, 2);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
